package com.learning.mybatis.mapper.param.service.impl;

import com.learning.mybatis.mapper.param.mapper.IUserMapper;
import com.learning.mybatis.mapper.param.entity.User;
import com.learning.mybatis.mapper.param.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * ClassName: UserServiceImpl
 * Description:
 * Date: 2020/7/22 16:19 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserServiceImpl implements IUserService {

    @Autowired
    private IUserMapper userMapper;
    
    @Override
    public int add(User user) {
        return userMapper.add(user);
    }

    @Override
    public int delete(int id) {
        return userMapper.delete(id);
    }

    @Override
    public int update(User user) {
        return userMapper.update(user);
    }

    @Override
    @Transactional(readOnly = true, rollbackFor = Exception.class)
    public User select(int id) {
        return userMapper.select(id);
    }
}
